/*
 * Copyright 2003-2005 (c) Live Media Pty Ltd. <argot@einet.com.au> 
 *
 * This software is licensed under the Argot Public License 
 * which may be found in the file LICENSE distributed 
 * with this software.
 *
 * More information about this license can be found at
 * http://www.einet.com.au/License
 * 
 * The Developer of this software is Live Media Pty Ltd,
 * PO Box 4591, Melbourne 3001, Australia.  The license is subject 
 * to the law of Victoria, Australia, and subject to exclusive 
 * jurisdiction of the Victorian courts.
 */

#ifndef TYPES__H_INCLUDED
#define TYPES__H_INCLUDED

#ifdef __cplusplus
extern "C" {
#endif

#include "TypePlatform.h"

/* Define our own malloc and free macros */

#define type_malloc( x ) malloc( x )
#define type_free( x ) free( x )

typedef struct type_name
{
	char * name;
	int hash;
} type_name;

#define type_name_equal( t1, t2 ) ((t1)->hash == (t2)->hash)

typedef struct type_element type_element;
typedef struct type_input_stream type_input_stream;
typedef struct type_output_stream type_output_stream;
typedef struct type_library type_library;
typedef struct type_map type_map;
typedef struct type_definition type_definition;

typedef struct type_buffer
{
	char * data;
	int size;
}
type_buffer;

#include "util/intmap.h"
#include "util/typestack.h"

typedef struct argot_error
{
	int rc; /* return code */
} argot_error;

#define TYPE_READ_ERROR 11
#define TYPE_WRITE_ERROR 12
#define TYPE_EOF 10

typedef int (*typeReader)( type_input_stream * in, type_element * element, void * data );
typedef int (*typeWriter)( type_output_stream * out, void * object, type_element * element, void * data );

typedef struct type_reader type_reader;
typedef struct type_writer type_writer;

#ifdef __cplusplus
}
#endif

#include "TypeObject.h"
#include "TypeElement.h"
#include "TypeDefinition.h"
#include "TypeLibrary.h"
#include "TypeMap.h"
#include "ReferenceTypeMap.h"
#include "TypeInputStream.h"
#include "TypeOutputStream.h"
#include "TypeReaderAuto.h"
#include "TypeCore.h"
#include "TypeMapCore.h"

#endif
